<!--
  @author nowind
  @since 17/07/23 14:34
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/common::jscss"/>
<title>新增或编辑产品</title>
</head>
<body>
<div class="layui-fluid">
    <blockquote class="layui-crumb">
        计价器产品>产品管理>
        <a lay-href="/tariffProduct/list.action">计价器产品管理</a>>
        <zmn>[[${servProductVO.name}]]</zmn>
    </blockquote>

    <div class="layui-card">
        <div th:replace="product/tariff/_tab::tab"></div>

        <div class="layui-card-body">

            <form method="post" action="" class="layui-form" lay-filter="zmn-form">

                <input type="hidden" name="productId" th:value="${servProductVO.productId}"/>
                <input type="hidden" name="productType" value="1"/>

                <div class="layui-card-header" style="margin-top:10px;"><b>基本信息</b></div>

                <div class="layui-form-item" th:if="${servProductVO.productId > 0}">
                    <label class="layui-form-label">产品ID：</label>
                    <div class="layui-input-block">
                        <div class="layui-form-mid">
                            <span th:text="${servProductVO.productId}">ID</span>
                            <span th:text="${servProductVO.status == 2 ? '上架' : '下架'}">status</span>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">服务分类：</label>
                    <div class="layui-input-inline">
                        <select name="servCategId" id="servCategId" lay-filter="servCategId" lay-verify="required"
                                th:value="${servProductVO.servCategId}" lay-search="">
                            <option value="">请选择</option>
                            <zmn th:each="categ:${servCategories}">
                                <option th:value="${categ.categId}" th:selected="${categ.categId == servProductVO.servCategId}"
                                        th:text="${categ.showName}">
                                    分类名称
                                </option>
                            </zmn>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">前台分类：</label>
                    <div class="layui-input-inline">
                        <select name="categOneId" id="categOneId" lay-filter="categOneId" lay-verify="required"
                                th:value="${servProductVO.categOneId}" lay-search="">
                            <option value="">请选择</option>
                            <zmn th:each="basecateg:${baseCategories}">
                                <option th:value="${basecateg.key}" th:selected="${basecateg.key == servProductVO.categOneId}"
                                        th:text="${basecateg.value}">分类名称
                                </option>
                            </zmn>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <select name="categId" id="categId" lay-verify="required" lay-filter="categId" th:value="${servProductVO.categId}" lay-search="">
                            <option value="">请选择</option>
                            <zmn th:each="basecateg:${categoryVOList}">
                                <option th:value="${basecateg.categId}" th:selected="${basecateg.categId == servProductVO.categId}"
                                        th:text="${basecateg.categName}">分类名称
                                </option>
                            </zmn>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">产品名称：</label>
                    <div class="layui-input-inline" style="width: 390px">
                        <input type="text" name="name" th:value="${servProductVO.name}" placeholder="请输入产品名称"
                               lay-verify="required" autocomplete="off" class="layui-input" maxlength="50"/>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">产品副标题：</label>
                    <div class="layui-input-inline" style="width: 390px">
                        <input type="text" name="showTitle" th:value="${servProductVO.showTitle}" placeholder="请输入产品副标题"
                              autocomplete="off" class="layui-input" maxlength="50"/>
                    </div>
                </div>

                <!--<div class="layui-form-item">-->
                    <!--<label class="layui-form-label">故障分组：</label>-->
                    <!--<div class="layui-input-inline">-->
                        <!--<select name="faultGroupId" id="faultGroupId" lay-search="" lay-filter="faultGroupId" lay-verify=""-->
                                <!--th:value="${servProductVO.faultGroupId}">-->
                            <!--<option value="">请选择</option>-->
                            <!--<zmn th:each="fault:${faults}">-->
                                <!--<option th:value="${fault.groupId}" th:selected="${fault.groupId == servProductVO.faultGroupId}"-->
                                        <!--th:text="${fault.name}">故障分组-->
                                <!--</option>-->
                            <!--</zmn>-->
                        <!--</select>-->
                    <!--</div>-->
                <!--</div>-->
                <!--<div class="layui-form-item">-->
                    <!--<label class="layui-form-label">保修分组：</label>-->
                    <!--<div class="layui-input-inline">-->
                        <!--<select name="warrantyGroupId" id="warrantyGroupId" lay-search="" lay-filter="warrantyGroupId"-->
                                <!--lay-verify="" th:value="${servProductVO.warrantyGroupId}">-->
                            <!--<option value="">请选择</option>-->
                            <!--<zmn th:each="warranty:${warrantys}">-->
                                <!--<option th:value="${warranty.groupId}" th:selected="${warranty.groupId == servProductVO.warrantyGroupId}"-->
                                        <!--th:text="${warranty.name}">保修分组-->
                                <!--</option>-->
                            <!--</zmn>-->
                        <!--</select>-->
                    <!--</div>-->
                <!--</div>-->
                <!--<div class="layui-form-item">-->
                    <!--<label class="layui-form-label layui-form-required">绩效分类：</label>-->
                    <!--<div class="layui-input-inline">-->
                        <!--<select name="ficoCtegId" id="ficoCtegId" lay-search="" lay-verify="required" th:value="${servProductVO.ficoCtegId}">-->
                            <!--<option value="">请选择</option>-->
                            <!--<zmn th:each="ficoCategory:${ficoCategoryList}">-->
                                <!--<option th:value="${ficoCategory.categId}" th:selected="${ficoCategory.categId == servProductVO.ficoCtegId}"-->
                                        <!--th:text="${ficoCategory.name}">绩效分类-->
                                <!--</option>-->
                            <!--</zmn>-->
                        <!--</select>-->
                    <!--</div>-->
                <!--</div>-->
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">单位：</label>
                    <div class="layui-input-inline">
                        <select name="unit" id="unit" lay-verify="required" th:value="${servProductVO.ficoCtegId}" lay-search="">
                            <option value="">请选择</option>
                            <zmn th:each="ficoCategory:${unitList}">
                                <option th:value="${ficoCategory}" th:selected="${ficoCategory == servProductVO.unit}" th:text="${ficoCategory}">
                                </option>
                            </zmn>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">排序：</label>
                    <div class="layui-input-inline">
                        <input type="number" name="showSort" autocomplete="off" maxlength="10" class="layui-input" th:value="${servProductVO.showSort}"
                               lay-verify="isPositiveNumber|required" onkeyup="if(this.value.length>7) this.value=this.value.slice(0,8);value=value.replace(/^(0+)|[^\d]+/g,'')">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">业务类型：</label>
                    <div class="layui-input-block">
                        <input type="checkbox" name="bizType" value="1" title="C-保外业务"
                               th:checked="${servProductVO.bizType != null && servProductVO.bizType.indexOf('1') != -1}">
                        <input type="checkbox" name="bizType" value="2" title="F-保内业务"
                               th:checked="${servProductVO.bizType != null && servProductVO.bizType.indexOf('2') != -1}">
                        <input type="checkbox" name="bizType" value="3" title="B-工程业务"
                               th:checked="${servProductVO.bizType != null && servProductVO.bizType.indexOf('3') != -1}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">状态：</label>
                    <div class="layui-input-block">
                        <!--新增智能下架，因为没有关联后台产品-->
                        <zmn th:if="${servProductVO.productId == null}">
                            <input type="radio" name="status" value="2" title="上架" disabled>
                            <input type="radio" name="status" value="1" title="下架" checked>
                        </zmn>
                        <zmn th:if="${servProductVO.productId != null}">
                            <input type="radio" name="status" value="2" title="上架" th:checked="${servProductVO.status == 2}">
                            <input type="radio" name="status" value="1" title="下架"
                                   th:checked="${servProductVO.status == 1}">
                        </zmn>

                    </div>
                </div>

                <zmn th:if="${servProductVO.productId > 0}">
                    <div class="layui-card-header layui-margin-b"><b>其他信息</b></div>

                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">修改人/时间：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${servProductVO.updater} + '&nbsp;/&nbsp;' + ${#dates.format(servProductVO.updateTime, 'yyyy-MM-dd HH:mm:ss')}">
                                修改人/时间
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-item-sm">
                        <label class="layui-form-label">创建人/时间：</label>
                        <div class="layui-input-block">
                            <div class="layui-form-mid layui-word-aux"
                                 th:text="${servProductVO.creater} + '&nbsp;/&nbsp;' + ${#dates.format(servProductVO.createTime, 'yyyy-MM-dd HH:mm:ss')}">
                                创建人/时间
                            </div>
                        </div>
                    </div>
                </zmn>

                <div class="layui-form-item submit">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="zmn-form-submit"
                                th:if="${#authPermit.checkPermit('/tariffProduct/addEdit.action')}">保存
                        </button>
                        <button type="reset" class="layui-btn layui-btn-primary"
                                onclick="parent.layui.element.tabDelete('layadmin-layout-tabs', window.location.pathname + window.location.search)">取消
                        </button>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>
</body>
</html>
<script type="text/javascript" th:inline="javascript">
    var json = {
        servProductVO: [[${servProductVO}]],
        attrList: [[${attrList}]]
    };
    layui.config({
        version: 201909090111,
        base: "/static/lay/"
    }).extend({
        index: "lib/index",
        product_tariff_edit_js: "product/tariff/zmn.plat.product.tariff.edit"
    }).use(['index', 'product_tariff_edit_js']);
</script>